﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>ORM Smackdown</title>
		<style type="text/css" >
		    body{font-family:Arial; background:#f0f0f0}
		    div {border:1px solid black; background-color:White;padding:8px;width:500px}
		    label {font-weight:bold}
            a {color:Navy;}
		    a:hover {text-decoration:none}
		    ul {list-style-type:none; font-size:20px}
		</style> 				

	</head>
	<body>
	<h1>ORM Smackdown</h1>
	<ul>
	    <li><a href='AdoNet\Notes.htm'>ADO.NET</a></li>
	    <li><a href='EntityFrameworks\Notes.htm'>Entity Frameworks</a></li>
	    <li><a href='LightSpeedORM\Notes.htm'>LightSpeed O/R Mapper</a></li>
	    <li><a href='LinqToSql\Notes.htm'>LINQ to SQL</a></li>
	    <li><a href='LLBLGen\Notes.htm'>LLBLGen</a></li>
	    <li><a href='NHibernate\Notes.htm'>NHibernate and Linq to NHibernate</a></li>
	    <li><a href='SubSonic\Notes.htm'>SubSonic</a></li>
	    <li><a href='SubSonic3\Notes.htm'>SubSonic 3</a></li>
	</ul>
	<p>
	While watching the SQL Trace, you will often see "sp_reset_connection" what does this actually do?
	</p>
	<p>
	According to http://www.sqldev.net/misc/sp_reset_connection.htm
	</p>
    <p>sp_reset_connection resets the following aspects of a connection:</p>
    <ul>
        <li>It resets all error states and numbers (like @@error)</li>
        <li>It stops all EC's (execution contexts) that are child threads of a parent EC executing a parallel query</li>
        <li>It will wait for any outstanding I/O operations that is outstanding</li>
        <li>It will free any held buffers on the server by the connection</li>
        <li>It will unlock any buffer resources that are used by the connection</li>
        <li>It will release all memory allocated owned by the connection</li>
        <li>It will clear any work or temporary tables that are created by the connection</li>
        <li>It will kill all global cursors owned by the connection</li>
        <li>It will close any open SQL-XML handles that are open</li>
        <li>It will delete any open SQL-XML related work tables</li>
        <li>It will close all system tables</li>
        <li>It will close all user tables</li>
        <li>It will drop all temporary objects</li>
        <li>It will abort open transactions</li>
        <li>It will defect from a distributed transaction when enlisted</li>
        <li>It will decrement the reference count for users in current database; which release shared database lock</li>
        <li>It will free acquired locks</li>
        <li>It will releases any handles that may have been acquired</li>
        <li>It will reset all SET options to the default values</li>
        <li>It will reset the @@rowcount value</li>
        <li>It will reset the @@identity value</li>
        <li>It will reset any session level trace options using dbcc traceon()</li>
    </ul>
    <p>
    sp_reset_connection will NOT reset:
    </p>
    <ul>
        <li>Security context, which is why connection pooling matches connections based on the exact connection string</li>
        <li>If you entered an application role using sp_setapprole, since application roles can not be reverted</li>
    </ul>
	</body>
</html>